<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
  String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改客户信息</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="<%=path1%>/qt/ycss/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="<%=path1%>/qt/ycss/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="yjs/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="<%=path1%>/qt/yjs/bootstrap.min.js"></script>
    
<script type="text/javascript" src="<%=path1%>/scripts/jquery-1.7.2.js"></script> 
<script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/jquery.jqGrid.src.js"></script>
<script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/i18n/grid.locale-cn.js"></script>
<script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/jquery.jqGrid.min.js"></script>
 <script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

$(document).ready(function(){
	 $.ajax({ 	
	        type:"Post",  
	        dataType: 'json',  
	        url:"<%=path1%>/role/selectRoleAll.do", 
	        error:function(data){ 
	        //	alert(data);	 
	             alert("出错了！！");  
	        },  
	        success:function(data){
	        //	alert(data);
	        	//alert(data.rows[0].menu_name);
	        	
	        	 var sel= document.getElementById("jueshi"); 
	             sel.options.add(new Option("请选择",""));
	        
	             jQuery.each(data.rows, function(i,item){ 
	           	  
	              sel.options.add(new Option(item.role_name,item.role_id));
	      		    
	             });
	        	
	         }  
	         }); 
   }); 

   $(document).ready(function(){
  	 $.ajax({ 	
  	        type:"Post",  
  	        dataType: 'json',  
  	        url:"<%=path1%>/qt/Organization/selectAll.do", 
  	        error:function(data){ 
  	        //	alert(data);	 
  	             alert("出错了！！");  
  	        },  
  	        success:function(data){
  	        //	alert(data);
  	        	//alert(data.rows[0].menu_name);
  	        	
  	        	 var sel= document.getElementById("jigou"); 
  	             sel.options.add(new Option("请选择",""));	        
  	             jQuery.each(data.rows, function(i,item){ 
  	              sel.options.add(new Option(item.organization_name,item.organization_id));
  	      		    
  	             });
  	        	
  	         }  
  	         }); 
      }); 

$(document).ready(function(){
	var SeachSql;
	var id;
    var str=window.location.href; //得到listclient的地址
    //alert("str"+str);
    var es=/id=/; 
    es.exec(str); //得到地址后面变量名称
    //alert("es--"+es.exec(str));
    var right=RegExp.rightContext;//得到地址后面变量名称的值
    //alert("right-"+right);

    id=right;//将结果赋值给id
    
    if(id!="" )
	  {
    	customer_id =id;
	  }
     return select(id);  
});

function select(v){
	 $.ajax({  
	      data: {user_id:v},  
	      type:"Post",  
	      dataType: 'json',  
	       url:"<%=path1%>/selectbyid",  
	       error:function(data){  
	           alert("出错了！！");  
	       },  
	      success:function(data){  
	        	$("#name").val(data.msg.name);
	        	$("#mima").val(data.msg.password);
	        	$("#tel").val(data.msg.tel);
	        	$("#user_id").val(data.msg.user_id);
	        	

	       }  
	       });  
	
}







</script>

<!-- 得到修改的值  修改后跳回显示页 -->
<script type="text/javascript">
    function ajaxUpdate(){
    	
    	alert($("#customer_id").val());
        $.ajax({ 	
        data: {customer_id:$("#customer_id").val(),customer_name:$("#customer_name").val(),tel:$("#tel").val(),sex:$("input[name='sex']:checked").val(),customer_type:$("input[name='customer_type']:checked").val(),describel:$("#describel").val(),maritalStatus:$("#maritalStatus").val(),address:$("#address").val()},
        type:"Post",  
        dataType: 'json',  
        url:"./Customer/updateCustomer.do", 
        error:function(data){  
             alert("修改出错了！！");  
        },  
        success:function(data){
        	alert('修改成功！');
        	window.location.href = 'listCustomer.jsp'; 
         }  
         });  
     } 
    // 重置
    function ajaxReset(){
    	$("#name").val("");
    	$("#mima").val("");
    	$("#tel").val("");
    }
</script>

</head>
<body>
 
  
       
      
<form action="../updateuser">
<div style="width: 600px; margin-left:auto; margin-right:auto;">
<div class="form-group has-success">
  <label class="control-label" for="inputSuccess1"></label>
  <input type="hidden" id="user_id" name="user_id" />
  用户：<input type="text" class="form-control" name="name" id="name" placeholder="用户名称" />
</div>
<div class="form-group has-success">
  <label class="control-label" for="inputSuccess1"></label>
  密码 ：<input type="password" class="form-control" name="password" id="mima" placeholder="密码" />
</div>
<div class="form-group has-success">
  <label class="control-label" for="inputSuccess1"></label>
  电话：<input type="text" class="form-control" name="tel" id="tel" placeholder="电话" />
</div>
 角色：<select class="form-control" name="rol_id" id="jueshi">
    </select>
 机构：<select class="form-control" name="organization_id" id="jigou">
</select>



</br>
   　　　　　　    <input type="submit" value="　提　交"  class="btn btn-success"/>
   　　　　　　　 <input type="button" value="　取　消"  class="btn btn-success"/>
　　　　　　　　
　　　　　　　　
</div>
</form>
    
     

</body>
</html>
